package com.cy.store.controller;

import com.cy.store.pojo.Order;
import com.cy.store.service.IOrderService;
import com.cy.store.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @PROJECT_NAME: store
 * @DESCRIPTION:
 * @USER: 28416
 * @DATE: 2022/11/10 15:51
 */
@RequestMapping("order")
@RestController
public class OrderController extends  BaseController{
    @Autowired
    private IOrderService orderService;

    @RequestMapping("create")
    public JsonResult<Order> create(Integer aid, Integer[] cids, HttpSession session) {
        Order date = orderService.create(aid, getUidFromSession(session), getUsernameFromSession(session), cids);
        return  new JsonResult<Order>(OK,date);
    }
}
